package com.feng.fengDUtil.dao.converter.impl;

import com.feng.fengDUtil.dao.converter.Converter;

import java.io.Reader;
import java.io.StringReader;
import java.sql.PreparedStatement;
import java.sql.SQLException;

public class EnumDefaultConverter  extends Converter {
    public void serialize(PreparedStatement ps, int clolumnIndex) {
        Object param = this.getSerializeParam();
        if (param != null) {
            String str = param.toString();
            try {
                ps.setCharacterStream(clolumnIndex, new StringReader(str), str.length());
            } catch (SQLException e) {
                e.printStackTrace();
            }
        }
    }

    @Override
    public Object wrap(Object param) {
        return ((Enum)param).name();
    }

    public Object deSerialize(Reader var1) {
        return null;
    }
}
